//
//  BlockViewController.swift
//  SwiftDemo
//
//  Created by Jason on 15/10/30.
//  Copyright © 2015年 Jason Jiang. All rights reserved.
//


public typealias blockOne = () -> Void
public typealias blockTwo = (str:String) -> String

import UIKit


class BlockViewController: UIViewController {

    let block1 :blockOne = {}
    
    var block2 :blockTwo =  { (str:String) in
    
        NSLog("block 数据是%@",str);
        return str;
    
    }

    
    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        self.navigationItem.title = "Block"
        self.view.backgroundColor = UIColor.grayColor();
        let btn:UIButton = UIButton (type: UIButtonType.Custom);
        btn.frame = CGRectMake(0, 64, 100, 80);
        btn.setTitle("blockBtn", forState: UIControlState.Normal);
        btn.addTarget(self, action: Selector("sendBlock"), forControlEvents: UIControlEvents.TouchUpInside);
        self.view.addSubview(btn);
        
        
    }
    
    
    
    func sendBlock(){
        
        NSLog("fasfdfa");
        
        block2 (str: "dfdddd");
        
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}




